<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Bank_mdl extends CI_Model{
    function __construct(){
        parent::__construct();
        $this->load->database();
    }

	function getListBank(){
		$query=$this->db->query("SELECT * FROM t_bank_kpr");
		if ($query->num_rows()>0){
			$data = array();
			$i=0;
			foreach ($query->result_array() AS $row){
				
				$row["kode_bank"];
				$row["nama_bank"];
				$row["dt_stamp"];
				$row["update_id"];
				
				$data[$i] = $row;
				$i++;
			}
			return $data;
				
		}
	
	}
	
    public function SaveAdd($data){
		$this->db->insert('t_bank_kpr',$data);
	}
	
	public function SaveEdit($data){
		$this->db->where('kode_bank',$this->input->post('kode_bank'));
		$this->db->update('t_bank_kpr',$data);
	} 
	
	public function Delete($id){
	    $this->db->where('kode_bank',$id);
		$this->db->delete('t_bank_kpr'); 	
	}
	
}	
?>